import request from '@/utils/request'

// 获取装修备份数据
export function getBackUp(params) {
  return request({
    url: '/zhmd/shop/decoration/list',
    method: 'get',
    params
  })
}

// 删除备份数据
export function delBackUpData(params) {
  return request({
    url: `/zhmd/shop/decoration/${params.id}`,
    method: 'delete',
    params
  })
}

// 新增装修备份数据
export function addBackUpDIY(data) {
  return request({
    url: `/zhmd/shop/decoration/quick/shot`,
    method: 'post',
    data
  })
}

// 获取装修数据详情
export function getDiy(params) {
  return request({
    url: `/zhmd/shop/decoration`,
    method: 'get',
    params
  })
}

// 预览
export function previewDiyData(data) {
  return request({
    url: `/custom/decorations/preview`,
    method: 'post',
    data
  })
}

// 保存装修数据
export function saveDiy(data) {
  return request({
    url: `/zhmd/shop/decoration`,
    method: 'put',
    data
  })
}

// 获取我的图库
export function getPhotoList(params) {
  return request({
    url: `/gallery`,
    method: 'get',
    params
  })
}

// 删除单张图片
export function deletePhotoItem(data) {
  return request({
    url: `/gallery/${data}`,
    method: 'delete'
  })
}

// 图库弹层图片列表
export function getLayerList(params) {
  return request({
    url: `/gallery/layer`,
    method: 'get',
    params
  })
}

// 添加分类
export function createCategory(params) {
  return request({
    url: `/gallery/category`,
    method: 'post',
    params
  })
}

// 获取弹层分类
export function getCategoryList(params) {
  return request({
    url: `/gallery/layer/category`,
    method: 'get',
    params
  })
}

// 删除单张图片
export function deletePhoto(data) {
  return request({
    url: `/gallery/${data}`,
    method: 'delete'
  })
}

// 批量删除图片
export function deletePhotos(data) {
  return request({
    url: `/gallery/batch/destroy`,
    method: 'post',
    data
  })
}

// 弹层分类编辑
export function editCategoryItem(data) {
  return request({
    url: `/gallery/category/${data.id}`,
    method: 'patch',
    data
  })
}

// 弹层分类删除
export function delCategoryItem(data) {
  return request({
    url: `/gallery/category/${data}`,
    method: 'delete'
  })
}

// 批量移动图片
export function movePhotos(data) {
  return request({
    url: `/gallery/batch/category`,
    method: 'post',
    data
  })
}

// 编辑名称
export function editName(data) {
  return request({
    url: `/gallery/${data.id}`,
    method: 'patch',
    data
  })
}

// 小程序设置
export function shopAppID(data) {
  return request({
    url: `/shop/appid`,
    method: 'post',
    data
  })
}
